package edu.snake.implement.view.inputInterface;


import edu.snake.core.service.ViewController;

import java.awt.event.InputEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class MouseController extends MouseAdapter {
    private final ViewController controller;

    public MouseController(ViewController controller) {
        this.controller = controller;
    }

    @Override
    public void mousePressed(MouseEvent e) {
        int modifiers = e.getModifiers();
        if ((modifiers & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) {
            controller.getFromView("LEFT");
        }
        if ((modifiers & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) {
            controller.getFromView("RIGHT");
        }
    }

}
